--[[

    Elements handled: .dots
    
    Dots should contain an array of dots. Each dot is simply a texture and
    associated state setting handler that gets called on aura updates.
    
    For more see dots(...) in style.lua.

]]--

local function Update(self, event, unit)
    if not self.unit then return end
    if self.dots then
        for dotIndex,dot in ipairs(self.dots) do
            dot.handler(self, unit, self['dotTexture'..tostring(dotIndex)], event, dotIndex)
        end
    end
    
end

local function Enable(self)
    if self.dots then
        self:RegisterEvent("UNIT_AURA", Update)
        return true
    end
end

local function Disable(self)
    if self.dots then
        self:UnregisterEvent("UNIT_AURA", Update)
    end
end

oUF:AddElement('dots', Update, Enable, Disable)